package com.atguigu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName OrderConsulController
 * @Author VCR
 * @Date 2021/12/24 16:29
 * @Version 1.0
 */
@RestController
@RequestMapping("consumer")
@Slf4j
public class OrderConsulController {
    public static final String INVOME_URL = "http://consul-provider-payment";

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/payment/consul")
    public String paymentInfo() {
        String template = restTemplate.getForObject(INVOME_URL + "/payment/consul", String.class);
        return template;
    }
}
